package org.qloudgen.borg.result;

import java.sql.ResultSet;
import java.util.List;

import org.qloudgen.borg.CommonValues;
import org.qloudgen.borg.utils.export.ExcelFile;

public class DataExportOperator extends AbstractResultOperator{
	
	public DataExportOperator(String fileName,List<String> headers) {
		super(fileName,headers);
	}

	@Override
	protected void doResult(ResultSet res) throws Exception {
		
		ExcelFile excel = new ExcelFile(this.fileName,"sheet");
		excel.setHeaders(this.headers);
		
		excel.writeDataToExcel(res, CommonValues.DEFAULT_EXCEL_LIMIT);
		excel.saveToFile();
	}
	
}
